home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-16 | 2.3 KB | 85 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 3281057 12-April-90 13:04PDT
-
- From: POWERUP.ENG Power Up Software,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: None
-
- Attn: MacApp.Tech$
- SentBy: James Plamondon
- Date 4/6/90
- Subject None
- From James Plamondon
- To MacApp.Tech$
-
- Subject:
- Gentlepersons,
-
- I have a question of style that is causing some dissention here — and I was
- hoping to put the issue to an informal vote.
-
- Assume the existence of the MacApp 2.0 Final routine PostCommand(), which
- posts the given command to the command queue. Given this function (and the
- command queue), one can contemplate writing a TCmdButton control, which posts
- a command when pressed.
-
- Assume further that the class TCmdButton has a field, fCmdClassName, which
- specifies the class of command to be posted. (We can use
- NewObjectByClassName() to build the command.)
-
- The argument rages over two possible implementations of TCmdButton's command
- posting: Should it be placed in an override of TrackMouse(), or in an
- override of DoChoice()? Either will work; it is just a question of elegance,
- clarity, and the quality of being insulated from future changes to MacApp.
-
- Here are example implementations:
-
- {—————————————————————————————————————————}
-
- PROCEDURE TCmdButton.TrackMouse(<its arguments>); OVERRIDE;
- BEGIN
- INHERITED TrackMouse(<same arguments>);
-
- IF (aTrackPhase = trackRelease)
- THEN
- BEGIN
- { create, initialize, and post the command }
- END;
- END; { TrackMouse }
-
- {—————————————————————————————————————————}
-
- …OR…
-
- {—————————————————————————————————————————}
-
- PROCEDURE TCmdButton.DoChoice(<its arguments>); OVERRIDE;
- BEGIN
- IF (origView = SELF) &
- (itsChoice = mButtonHit)
- THEN
- BEGIN
- { create, initialize, and post the command }
- END;
-
- INHERITED DoChoice(<same arguments>);
- END; { TrackMouse }
-
- {—————————————————————————————————————————}
-
- Note that SELF.DoChoice() is called in TControl.TrackMouse() when aTrackPhase
- = trackRelease.
-
- Without biasing your opions one way or the other by giving my preference, I
- ask: which implementation do you prefer, and why?
-
- Looking forward to your responses, I remain,
-
- Yours,
-
- James Plamondon
-
-